home *** CD-ROM | disk | FTP | other *** search
- Path: news.cencom.net!ns!tanp
- From: tanp@ns (Bill Wendling)
- Newsgroups: comp.lang.c
- Subject: Re: compiling- gcc v.s. cc
- Date: 1 Feb 1996 08:19:36 GMT
- Organization: Cen-Com Internet
- Distribution: world
- Message-ID: <4ept2o$jbs@news.cencom.net>
- References: <4emvi6$j4@cnn.Princeton.EDU>
- NNTP-Posting-Host: ns.cencom.net
- X-Newsreader: TIN [version 1.2 PL2]
-
- CIT Information Centers inexplicably wrote:
-
- } I am a mathematician and have written most of my C programs
- } for my own use. Unfortunately, I now need to make a program of mine
- } available to the world and have some questions.
-
- } 1) Is the GNU C compiler (gcc) a standard compiler that most unix
- } users have at their disposal?
-
- This depends on what their sysop has put on the computer for them to use.
- gcc is available over the net to anyone free of charge.
-
- } The reason I'm asking is because I want to provide instructions
- } for compiling my program. I've been using gcc and it works fine.
-
- You could make up a "make" file which will take care of the compilation
- without need for a lot of instruction.
-
- } I experimented with cc but did did not get consistent results.
- } On an SGI it compiled fine (both with gcc and cc), but not on
- } Sun-4 it only compiled with gcc and not with cc (cc produced
- } a lot of error messages which seem to be connected to the
- } way I declared my functions. I use prototype form as opposed
- } to traditional form).
-
- } this brings me to question...
-
- } 2) Why would a program compile fine with cc on one machine but not on
- } another?
-
- The C compiler may be older on the machine that gives you the errors
- and doesn't support prototyping. You can get around this problem by
- making all prototypes conditionally "there" or not. Here is an example
- of a .h file which you could use (from _Obfuscated C And Other Mysteries_,
- by Don Libes. Copyright (C) 1993 by John Wiley & Sons, Inc.):
-
- -------------------------------------------------------------------------
- #ifndef PROTO_H
- #define PROTO_H
- #if __STDC__ == 1 || PROTOTYPES_EXIST
- #define PROTO(A) A
- #else
- #define PROTO(A) ()
- #endif /* has prototypes */
- #endif /* PROTO_H */
- ------------------------------------------------------------------------
-
- And then use it like:
-
- int foofunc PROTO((int bar, char baz));
-
-
- --
- Bill Wendling | "Pinky, are you thinking what I'm thinking?"
- tanp@ns.cencom.net | "I think so, Brain, but burlap chafes me so."
- "Boom Shanka" | Finger me for my Geek Code...NOW!
-